Click here to view the version of this FAQ entry for Sitecore 5.2.
Click here to view the version of this FAQ entry for Sitecore 5.3
Can I get the DataSource set and Parameters for a sublayout via code-behind?
Set a certain layout and sublayout for an item with Parameters and DataSource:
To be able to use the parameters, use the following code:
string rawParameters = Attributes[“sc_parameters”];
NameValueCollection parameters = Sitecore.Web.WebUtil.ParseUrlParameters(rawParameters);
Use the following code to get sublayout datasource in the codebehind of the sublayout:
protected void Page_Load(object sender, EventArgs e)
{
string ds = ((Sitecore.Web.UI.WebControls.Sublayout)this.Parent).DataSource;
}